import 'package:xinxuan/vo/common_vo/common_seckill_order_buyer_ov.dart';
import 'package:xinxuan/vo/common_vo/common_seckill_order_products_item_vo.dart';
import 'package:xinxuan/vo/common_vo/common_seckill_order_seller_vo.dart';

class SubmitSeckillOrderVo {

  SubmitSeckillOrderData? data;

  SubmitSeckillOrderVo({this.data});

  SubmitSeckillOrderVo.fromJson(Map<String, dynamic> json) {
    data = json['data'] != null ? new SubmitSeckillOrderData.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.toJson();
    }
    return data;
  }
}

class SubmitSeckillOrderData {
  String? orderSn;
  int? parentId;
  dynamic commissionRate;
  int? paymentStatus;
  int? buyerId;
  int? sellerId;
  int? teamId;
  int? status;
  int? source;
  int? totalAmount;
  String? updatedAt;
  String? createdAt;
  int? id;
  CommonSeckillOrderBuyerVo? buyer;
  CommonSeckillOrderSellerVo? seller;
  List<CommonSeckillOrderProductsItemVo>? products;

  SubmitSeckillOrderData(
      {this.orderSn,
      this.parentId,
      this.commissionRate,
      this.paymentStatus,
      this.buyerId,
      this.sellerId,
      this.teamId,
      this.status,
      this.source,
      this.totalAmount,
      this.updatedAt,
      this.createdAt,
      this.id,
      this.buyer,
      this.seller,
      this.products});

  SubmitSeckillOrderData.fromJson(Map<String, dynamic> json) {
    orderSn = json['order_sn'];
    parentId = json['parent_id'];
    commissionRate = json['commission_rate'];
    paymentStatus = json['payment_status'];
    buyerId = json['buyer_id'];
    sellerId = json['seller_id'];
    teamId = json['team_id'];
    status = json['status'];
    source = json['source'];
    totalAmount = json['total_amount'];
    updatedAt = json['updated_at'];
    createdAt = json['created_at'];
    id = json['id'];
    buyer = json['buyer'] != null ? new CommonSeckillOrderBuyerVo.fromJson(json['buyer']) : null;
    seller =
        json['seller'] != null ? new CommonSeckillOrderSellerVo.fromJson(json['seller']) : null;
    if (json['products'] != null) {
      products = [];
      json['products'].forEach((v) {
        products!.add(new CommonSeckillOrderProductsItemVo.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['order_sn'] = this.orderSn;
    data['parent_id'] = this.parentId;
    data['commission_rate'] = this.commissionRate;
    data['payment_status'] = this.paymentStatus;
    data['buyer_id'] = this.buyerId;
    data['seller_id'] = this.sellerId;
    data['team_id'] = this.teamId;
    data['status'] = this.status;
    data['source'] = this.source;
    data['total_amount'] = this.totalAmount;
    data['updated_at'] = this.updatedAt;
    data['created_at'] = this.createdAt;
    data['id'] = this.id;
    if (this.buyer != null) {
      data['buyer'] = this.buyer!.toJson();
    }
    if (this.seller != null) {
      data['seller'] = this.seller!.toJson();
    }
    if (this.products != null) {
      data['products'] = this.products!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}